#-*-coding:utf-8-*- 
import os
import os.path
import re

packDir='/home/mao/git_workspace/data-warehouse/ods/lbss'

p1=re.compile(r"sqoop_import_216")
def processDir(args,dirname,filenames):
	print 'start**********'
	m = 0
	for f in filenames:
		m+=1
		try:
			filObj = open(dirname+"/"+f)
			hasIf = False
			i = 0
			for line in filObj:
				i = i+1
				if p1.search(line):
					hasIf=True
					print i,' : ',line
			filObj.close()
			if hasIf:
				print m,'file: ',dirname,'/',f
				print '-------------------------------------------------------------------'
		except:
			pass

def search():
	os.path.walk(packDir,processDir,None)

if __name__=='__main__':
	search()
